/* Solana DApp Theme - Using Solana brand colors #9945FF and #14F195 */

:root {
  /* Solana Brand Colors */
  --solana-purple: #9945FF;
  --solana-green: #14F195;
  --solana-green-transparent: rgba(20, 241, 149, 0.3);
  --solana-purple-transparent: rgba(153, 69, 255, 0.3);
  /* Light Mode Colors */
  --sol-bg-primary: #ffffff;
  --sol-bg-primary-light: #fefefe;
  --sol-bg-secondary: #ededed;
  --sol-bg-tertiary: #e3e3e3;
  --sol-text-primary: #212529;
  --sol-text-secondary: #6c757d;
  --sol-text-muted: #adb5bd;
  --sol-border: #dee2e6;
  --sol-shadow: rgba(0, 0, 0, 0.1);

  /* Interactive Elements */
  --sol-primary: var(--solana-purple);
  --sol-primary-hover: #7c3aed;
  --sol-secondary: var(--solana-green);
  --sol-secondary-hover: #10b981;
  --sol-success: var(--solana-green);
  --sol-warning: #f59e0b;
  --sol-danger: #ef4444;

  /* Card & Component Colors */
  --sol-card-bg: var(--sol-bg-primary);
  --sol-card-border: var(--sol-border);
  --sol-navbar-bg: linear-gradient(135deg, var(--solana-purple), #7c3aed);
  --sol-navbar-text: #ffffff;
}

/* Dark Mode - System Preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --sol-bg-primary: #000000;
    --sol-bg-primary-light: #070707;
    --sol-bg-secondary: #161b22;
    --sol-bg-tertiary: #21262d;
    --sol-text-primary: #f0f6fc;
    --sol-text-secondary: #8b949e;
    --sol-text-muted: #6e7681;
    --sol-border: #30363d;
    --sol-shadow: rgba(0, 0, 0, 0.3);

    /* Adjust colors for dark mode */
    --sol-primary-hover: #a855f7;
    --sol-secondary-hover: #14f195;
    --sol-card-bg: var(--sol-bg-secondary);
    --sol-card-border: var(--sol-border);
    --sol-navbar-bg: linear-gradient(135deg, #1a1a1a, #2d1b69);
  }
}

/* User Preference Overrides */
:root[data-theme="dark"] {
  --sol-bg-primary: #0d1117;
  --sol-bg-secondary: #161b22;
  --sol-bg-tertiary: #21262d;
  --sol-text-primary: #f0f6fc;
  --sol-text-secondary: #8b949e;
  --sol-text-muted: #6e7681;
  --sol-border: #30363d;
  --sol-shadow: rgba(0, 0, 0, 0.3);

  /* Adjust colors for dark mode */
  --sol-primary-hover: #a855f7;
  --sol-secondary-hover: #14f195;
  --sol-card-bg: var(--sol-bg-secondary);
  --sol-card-border: var(--sol-border);
  --sol-navbar-bg: linear-gradient(135deg, #1a1a1a, #2d1b69);
}

:root[data-theme="light"] {
  --sol-bg-primary: #ffffff;
  --sol-bg-secondary: #f8f9fa;
  --sol-bg-tertiary: #e9ecef;
  --sol-text-primary: #212529;
  --sol-text-secondary: #6c757d;
  --sol-text-muted: #adb5bd;
  --sol-border: #dee2e6;
  --sol-shadow: rgba(0, 0, 0, 0.1);

  /* Light mode interactive colors */
  --sol-primary-hover: #7c3aed;
  --sol-secondary-hover: #10b981;
  --sol-card-bg: var(--sol-bg-primary);
  --sol-card-border: var(--sol-border);
  --sol-navbar-bg: linear-gradient(135deg, var(--solana-purple), #7c3aed);
}

/* Modern CSS with light-dark() function fallback */
body {
  background-color: light-dark(var(--sol-bg-primary), #0d1117);
  color: light-dark(var(--sol-text-primary), #f0f6fc);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  cursor: pointer;
}

/* Fallback for browsers without light-dark() support */
@supports not (color: light-dark(white, black)) {
  body {
    background-color: var(--sol-bg-primary);
    color: var(--sol-text-primary);
  }
}

/* Navigation */
.navbar {
  background: var(--sol-navbar-bg) !important;
  border-bottom: 2px solid var(--solana-green);
  backdrop-filter: blur(10px);
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--sol-navbar-text) !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.nav-link {
  color: rgba(255, 255, 255, 0.9) !important;
  font-weight: 500;
  transition: color 0.3s ease;
}

.nav-link:hover {
  color: var(--solana-green) !important;
}

/* modals */
.modal-content {
  background-color: var(--sol-bg-secondary);
  border: 1px solid var(--sol-border);
  border-radius: 0;
  box-shadow: 0 4px 16px var(--sol-shadow);
  transition: all 0.3s ease;
}

.modal-header {
  background: linear-gradient(135deg, var(--sol-bg-secondary), var(--sol-bg-tertiary));
  border-bottom: 1px solid var(--sol-border);
  border-radius: 0 !important;
  font-weight: 600;
}

.modal-body {
  background-color: var(--sol-bg-secondary);
  border: 1px solid var(--sol-border);
  border-radius: 0;
  box-shadow: 0 4px 16px var(--sol-shadow);
  transition: all 0.3s ease;
}

.modal-footer {
  background: linear-gradient(135deg, var(--sol-bg-secondary), var(--sol-bg-tertiary));
  border-top: 1px solid var(--sol-border);
  border-radius: 0 !important;
  font-weight: 600;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--solana-purple), #7c3aed);
  border: none;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(153, 69, 255, 0.3);
  transition: all 0.3s ease;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--sol-primary-hover), #6d28d9);
  box-shadow: 0 6px 20px rgba(153, 69, 255, 0.4);
}

.btn-outline-light {
  border-color: var(--solana-green);
  color: var(--solana-green);
  font-weight: 500;
}

.btn-outline-light:hover {
  background-color: var(--solana-green);
  border-color: var(--solana-green);
  color: #000;
}

.btn-primary {
  background: linear-gradient(135deg, var(--solana-purple), #7c3aed);
  border: none;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(153, 69, 255, 0.3);
  transition: all 0.3s ease;
}

.btn-success {
  background: linear-gradient(135deg, var(--solana-green), var(--solana-purple));
  border: none;
  box-shadow: 0 4px 12px rgba(20, 241, 149, 0.3);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  border: none;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-info {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  border: none;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.hidden {
  display: none;
}

/* Cards */
.card {
  background-color: var(--sol-card-bg);
  border: 1px solid var(--sol-card-border);
  border-radius: 0;
  box-shadow: 0 4px 16px var(--sol-shadow);
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 32px var(--sol-shadow);
}

.card-header {
  background: linear-gradient(135deg, var(--sol-bg-secondary), var(--sol-bg-tertiary));
  border-bottom: 1px solid var(--sol-border);
  border-radius: 0 !important;
  font-weight: 600;
}

.list-group-item {
  background-color: var(--sol-bg-secondary);
  border: 1px solid var(--sol-border);
  border-radius: 0;
  color: var(--sol-text-primary);
  transition: all 0.3s ease;
}

.list-group-item:hover {
  background-color: var(--sol-bg-tertiary);
  color: var(--sol-text-primary);
}

.list-group-item-action {
  color: var(--sol-text-primary);
}

.list-group-item-action:hover,
.list-group-item-action:focus {
  background-color: var(--sol-bg-tertiary);
  color: var(--sol-text-primary);
}

.list-group-item.active {
  background-color: var(--solana-purple);
  border-color: var(--solana-purple);
  color: #ffffff;
}

/* Form Elements */
.form-control {
  background-color: var(--sol-bg-secondary);
  border: 2px solid var(--sol-border);
  border-radius: 3px;
  color: var(--sol-text-primary);
  transition: all 0.3s ease;
}

.btn {
  border-radius: 3px;
}

.form-control:focus {
  background-color: var(--sol-card-bg);
  border-color: var(--solana-purple);
  color: var(--sol-text-primary);
  box-shadow: none;
  outline: none;
}

.form-control.invalid {
  border-color: var(--sol-danger);
  background-color: rgba(239, 68, 68, 0.1);
}

.form-control.valid {
  border-color: var(--sol-success);
  background-color: rgba(20, 241, 149, 0.1);
}

.form-label {
  color: var(--sol-text-secondary);
  font-weight: 600;
}

/* Top level divs of thread page */
#min-nav-row {
  height: 5vh !important;
  display: flex !important;
  flex-direction: column !important;
  font-size: 0.8em !important;
}

#min-nav-row .col-md-8 {
  padding: 0.5rem;
  border: 1px solid var(--sol-border);
  background-color: var(--sol-bg-secondary);
}

#min-nav-col {
  padding: 0.5rem;
  border: 1px solid var(--sol-border);
  background-color: var(--sol-bg-secondary);
}

#min-nav-row a {
  color: var(--solana-green);
  font-weight: 600;
  text-decoration: none;
}

#thread-app-row {
  height: 95vh !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

/* Ensure body doesn't scroll on thread pages */
body:has(#thread-app-row) {
  overflow: hidden !important;
  height: 100vh !important;
}

/* Column wrappers inside thread-app-row need to participate in flex layout */
#thread-app-row>.col-md-8 {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* The column containing reply-container should grow to fill space */
#thread-app-row>.col-md-8:has(.reply-container) {
  flex: 1;
  min-height: 0;
}

/* Thread Container */
.thread-container {
  background-color: var(--sol-bg-secondary);
  border: 1px solid var(--sol-border);
  border-radius: 0;
  height: auto;
  overflow: visible;
  padding: 0.5rem;
}

.reply-container {
  background-color: var(--sol-bg-primary-light);
  border: 1px solid var(--sol-border);
  border-radius: 0;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  padding: 0.5rem;
}

.composer-container {
  background-color: var(--sol-bg-secondary);
  border: 1px solid var(--sol-border);
  border-radius: 0;
  height: auto;
  overflow: visible;
  padding: 0.5rem;
}

.thread-container::-webkit-scrollbar,
.reply-container::-webkit-scrollbar,
.composer-container::-webkit-scrollbar,
.emoji-grid::-webkit-scrollbar {
  width: 8px;
}

.thread-container::-webkit-scrollbar-track,
.reply-container::-webkit-scrollbar-track,
.composer-container::-webkit-scrollbar-track,
.emoji-grid::-webkit-scrollbar-track {
  background: var(--sol-bg-tertiary);
  border-radius: 2px;
}

.thread-container::-webkit-scrollbar-thumb,
.reply-container::-webkit-scrollbar-thumb,
.composer-container::-webkit-scrollbar-thumb,
.emoji-grid::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--solana-purple), var(--solana-green));
  border-radius: 2px;
}

.thread-container::-webkit-scrollbar-thumb:hover,
.reply-container::-webkit-scrollbar-thumb:hover,
.composer-container::-webkit-scrollbar-thumb:hover,
.emoji-grid::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, var(--sol-primary-hover), var(--sol-secondary-hover));
}

.reply-container {
  font-size: 0.8em;
}

/* Chat Components */
.chat {
  background-color: var(--sol-card-bg);
  position: relative;
  margin-left: none;
  margin-right: none;
  margin-top: 1px;
  margin-bottom: none;
  padding-top: 2px;
  padding-left: 4px;
  padding-right: 0;
  padding-bottom: 3px;
  border-top: 1px solid var(--sol-border);
  border-left: 4px solid var(--sol-border);
  border-right: 1px solid rgba(0, 0, 0, 0);
  border-bottom: 1px solid rgba(0, 0, 0, 0);
}

/* When .chat is inside of a .chat, boder-right needs to be none */
.chat .chat {
  border-right: none;
}

.chat:hover {
  border-top-color: var(--solana-purple);
  border-left-color: var(--solana-purple);
  border-right-color: var(--solana-purple);
  border-bottom-color: var(--solana-purple);
}

.chat.tip_chat {
  /* Use /static/images/sol.png as background image, full width */
  background: transparent url('/static/images/sol_right.png') center center / cover no-repeat;
  border-top-color: var(--solana-green);
  border-left-color: var(--solana-green);
}

.chat.tip_chat:hover {
  border-top-color: var(--solana-green);
  border-right-color: var(--solana-green);
  border-bottom-color: var(--solana-green);
}

.chat.highlighted {
  background: light-dark(linear-gradient(135deg, rgba(20, 241, 149, 0.05), rgba(153, 69, 255, 0.05)),
      linear-gradient(135deg, rgba(20, 241, 149, 0.1), rgba(153, 69, 255, 0.1)));
}

.follow-btn:not(.text-muted) {
  color: var(--solana-green);
  opacity: 0.8;
}

.reaction-container {
  min-height: 1.4em;
}

.reaction-container .badge {
  border: none !important;
  outline: none !important;
  padding: 3px;
  margin: 1px;
  background: rgba(125, 125, 125, 0.2) !important;
  color: var(--sol-text-muted);
  font-weight: 300;
  box-shadow: none !important;
}

.reaction-container button,
.reaction-container button:hover {
  border: none !important;
  outline: none !important;
  background: transparent !important;
  padding: 3px;
  margin: 1px;
  font-size: 0.7em;
  opacity: 0.9;
  box-shadow: none !important;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  /* 12 equal columns */
  gap: 4px;
  /* space between emojis */
  justify-items: center;
  align-items: center;
  max-height: 40vh;
  overflow-y: auto;
}


.emoji-option {
  font-size: 1.2rem;
  line-height: 1;
  padding: 4px;
  width: 2rem;
  height: 2rem;
  text-align: center;
}

.emoji-grid button {
  border: none !important;
  outline: none !important;
}

.has_alias {
  color: var(--solana-purple);
  font-weight: 600;
}

.no_alias {
  opacity: 0.7;
  color: var(--sol-text-muted);
  font-size: 0.8em;
}

/* Public Key Display */
.pubkey-short {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.9em;
  color: var(--solana-purple);
  font-weight: 600;
  background: light-dark(rgba(153, 69, 255, 0.1),
      rgba(153, 69, 255, 0.2));
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

/* Blur Content */
.blur-content {
  filter: blur(4px);
  cursor: pointer;
  transition: filter 0.3s ease;
  background: light-dark(rgba(153, 69, 255, 0.05),
      rgba(153, 69, 255, 0.1));
  border-radius: 4px;
  padding: 0.5rem;
}

.blur-content:hover {
  filter: blur(2px);
}

.blur-content.revealed {
  filter: none;
  background: transparent;
}

/* Alert Messages */
.alert-info {
  background: light-dark(linear-gradient(135deg, rgba(20, 241, 149, 0.1), rgba(153, 69, 255, 0.1)),
      linear-gradient(135deg, rgba(20, 241, 149, 0.15), rgba(153, 69, 255, 0.15)));
  border: 1px solid var(--solana-green);
  color: var(--sol-text-primary);
}

.alert-success {
  background: light-dark(rgba(20, 241, 149, 0.1), rgba(20, 241, 149, 0.15));
  border: 1px solid var(--solana-green);
  color: var(--sol-text-primary);
}

.alert-warning {
  background: light-dark(rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.15));
  border: 1px solid var(--sol-warning);
  color: var(--sol-text-primary);
}

.alert-danger {
  background: light-dark(rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.15));
  border: 1px solid var(--sol-danger);
  color: var(--sol-text-primary)
}

/* Responsive Design */
@media (max-width: 768px) {
  .card {
    margin-bottom: 1rem;
  }
}

/* Animation Utilities */
@keyframes solana-pulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(153, 69, 255, 0.7);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(153, 69, 255, 0);
  }
}

.solana-pulse {
  animation: solana-pulse 2s infinite;
}

/* Gradient Text Utility */
.text-gradient {
  background: linear-gradient(135deg, var(--solana-purple), var(--solana-green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}
.reverse-text-gradient {
  background: linear-gradient(135deg, var(--solana-green), var(--solana-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

/* Loading Spinner */
.spinner-solana {
  border: 3px solid var(--sol-border);
  border-top: 3px solid var(--solana-purple);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.action-btn {
  /* usually contains a bootstrap icon (svg) */
  cursor: pointer;
  color: var(--solana-purple) !important;
  padding-left: 4px;
  padding-right: 4px;
}

.action-btn:hover {
  color: var(--solana-green) !important
}


/* Reply/Composer Form */
#reply_content {
  font-size: 0.8em;
  max-width: 50%;
  min-width: 37.5%;
  outline: none;
}

#tip_amount {
  max-width: 37.5%;
  min-width: 37.5%;
  outline: none;
}

.tip_pill {
  margin-right: 10px;
}

#reset_form_btn,
#send_btn {
  line-height: 0.7em;
  max-width: 12.5%;
  text-align: center !important;
  padding: 3px !important;
}

.thread-link-toggle {
  text-decoration: none;
}

.rounded-pill a {
  color: white;
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
}

.rounded-pill a:hover {
  color: white;
  text-decoration: underline;
  cursor: pointer;
  font-weight: 900;
}

#main-logo {
  background: linear-gradient(135deg, #9945FF 0%, #14F195 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

#main-logo:hover {
  background: linear-gradient(135deg, #7c3aed 0%, #10b981 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 10px rgba(153, 69, 255, 0.5);
}

#wallet-container {
  /* float div to right */
  float: right;
}

/* Navbar z-index fix - ensure navbar appears above cards and other content */
.navbar {
  z-index: 1030;
  position: relative;
}

.navbar-collapse {
  z-index: 1030;
}

/* Mobile: Right-align nav items for easier thumb access */
@media (max-width: 991.98px) {
  .navbar-nav {
    text-align: right;
  }

  .navbar-nav .nav-item {
    text-align: right;
  }
}

.home-override {
  font-size: 1.2em;
  font-weight: 600;
  text-shadow: 4px 5px 3px rgba(0, 0, 0, 0.95);
}

#wallet-container button {
  border-radius: 0 0 0 0 !important;
}

.nav-link.disabled {
  pointer-events: none;
  cursor: default;
  color: #6c757d !important;
  opacity: 0.6;
}

#tip_tracker {
  overflow: hidden;
  height: 1.2em;
  font-size: 0.8em;
  line-height: 1em;
  color: var(--sol-text-muted);
  border-radius: 0.6em;
}

#tips_to_author_bar {
  background-color: var(--solana-green-transparent);
  border-radius: 0;
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
}

#tips_to_others_bar {
  background-color: var(--solana-purple-transparent);
  border-radius: 0;
  display: block;
  position: absolute;
  top: 0;
  left: 100%;
  height: 100%;
  width: 100%;
}

.content_link {
  text-decoration: none;
  color: var(--sol-text-primary);
}

#new_message_dismiss {
  color: var(--solana-green);
  font-weight: 300;
  font-size: 0.8em;
  opacity: 0.8;
  cursor: pointer;
  text-decoration: none;
}

/* Profile Dropdown Styling */
#profileDropdown {
  padding: 0 !important;
  margin-left: 0.5rem;
}

#profileIconContainer {
  position: relative;
  cursor: pointer;
  transition: transform 0.2s ease;
}

#profileIconContainer:hover {
  transform: scale(1.05);
}

#profileIcon {
  border: 2px solid var(--solana-green);
  transition: border-color 0.3s ease;
}

#profileDropdown:hover #profileIcon {
  border-color: var(--solana-purple);
}

.profile-initials {
  font-weight: 600;
  border: 2px solid var(--solana-green);
  transition: border-color 0.3s ease;
}

#profileDropdown:hover .profile-initials {
  border-color: var(--solana-purple);
}

.dropdown-menu {
  background-color: var(--sol-bg-secondary);
  border: 1px solid var(--sol-border);
  border-radius: 0;
  box-shadow: 0 4px 16px var(--sol-shadow);
  min-width: 200px;
}

.dropdown-item {
  color: var(--sol-text-primary);
  transition: all 0.2s ease;
  padding: 0.5rem 1rem;
}

.dropdown-item:hover:not(.disabled) {
  background-color: var(--sol-bg-tertiary);
  color: var(--sol-text-primary);
}

.dropdown-item.disabled {
  color: var(--sol-text-muted);
  cursor: not-allowed;
  opacity: 0.5;
}

.dropdown-item:active:not(.disabled) {
  background-color: var(--solana-purple);
  color: #ffffff;
}

.dropdown-divider {
  border-color: var(--sol-border);
}